xen: credit2: implement yield()
authorDario Faggioli <dario.faggioli@citrix.com>
Fri, 30 Sep 2016 14:21:27 +0000 (16:21 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 30 Sep 2016 15:19:42 +0000 (16:19 +0100)
commita7fa4d5f53adbb1e26cf754ce53fcbc639455d8b
tree9bbe225f19e0ca739c80b5c7f7bc1e9952b9547a
parent7e88dabffa9bcacbb180d919ffd68357d4feeba6
xen: credit2: implement yield()

When a vcpu explicitly yields it is usually giving
us an advice of "let someone else run and come back
to me in a bit."

Credit2 isn't, so far, doing anything when a vcpu
yields, which means an yield is basically a NOP (well,
actually, it's pure overhead, as it causes the scheduler
kick in, but the result is --at least 99% of the time--
that the very same vcpu that yielded continues to run).

With this patch, when a vcpu yields, we go and try
picking the next vcpu on the runqueue that can run on
the pcpu where the yielding vcpu is running. Of course,
if we don't find any other vcpu that wants and can run
there, the yielding vcpu will continue.

Also, add an yield performance counter, and fix the
style of a couple of comments.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c
xen/common/schedule.c
xen/include/xen/perfc_defn.h